Now I want to search for an identifier in a 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 to search for ID as follows:
.setQuery(QueryBuilders.multiMatchQuery(query, ID, TITLE))
By the way, I can get the result with id, instead I cannot search with a title. I'm just looking with an id to get the results.
So, I changed it like that. I used MultiSearchResponse to try to execute two child queries.
One
.setQuery(QueryBuilders.idsQuery(TYPE).ids(query))
other
.setQuery(QueryBuilders.multiMatchQuery(query, TITLE,DESCRIPTION))
Unfortunately, I just get the result with a title or description. If I search for an identifier, I cannot get any results.
================= I would like to perform like this
curl -XGET localhost:9200/test/series/99
I want to get results with id. Unfortunately, I do not know how to make this code with the JAVA API.
Please let me know. Thank you