Not able to Query alphanumeric fields from ELASTIC SEARCH using TERMS QUERY


(kamdar.mufaddal) #1

Hi,

I am trying to query Alphanumeric values from the index using TERMS QUERY, But it is not giving me the output.

Query:

{
"size" : 10000,
"query" : {
"bool" : {
"must" : {
"terms" : {
"caid" : [ "A100945","A100896" ]
}
}
}
},
"fields" : [ "acco", "bOS", "aid", "TTl", "caid" ]
}

I want to get all the entries that has caid A100945 or A100896

The same query works fine for NUmeric fields.

I am not planning to use QueryString/MatchQuery as i am trying to build general query builder that can build query for all the request. Hence am looking to get the entries usinng TERMS Query only.

Note: I am using Java API org.elasticsearch.index.query.QueryBuilders for building the Query.

eg: QueryBuilders.termQuery("caid", "["A10xxx", "A101xxx"]")

Please help.

Regards,
Mik


(system) #2