java - Id search in elasticsearch -
now want search id in field.
builder.startobject().startobject(type_series).startobject("properties"); builder.startobject(id) .field("type", "long") .field("store", "yes") .field("index", "analyzed") .field("analyzer", "test_analyzer") .endobject(); builder.startobject(title) .field("type", "string") .field("store", "yes") .field("index", "analyzed") .field("analyzer", "test_analyzer") .field("boost", "10") .endobject();
i tried search id this:
.setquery(querybuilders.multimatchquery(query, id, title))
btw, can result id, instead cannot search title. search id getting results.
so changed this. used multisearchresponse tried execute 2 kids of queries.
one
.setquery(querybuilders.idsquery(type).ids(query))
the other
.setquery(querybuilders.multimatchquery(query, title,description))
unfortunately, result title or description. if search id, cannot results.
================ i'd execute
curl -xget localhost:9200/test/series/99
i want results id. unfortunately, don't know how make code java api.
please let me know. thanks.
there's _id field can search in. so, curl http://localhost:9200/_search?q=_id:99+and+_type:series+and+_index:test
or http://localhost:9200/test/series/_search?q=_id:99
should trick.
Comments
Post a Comment