How to add Dynamic Fields in search request


(smhdiu) #1

hello all

i have email firstname lastname field in the search index.
now at runtime may be user has only specified one of the filed to search or
may be all.
so my question is can we apply dynamic field in java api at runtime
depending upon the fields enter by the user.

thanks
mohsin

--


(Ivan Brusic) #2

All queries have an option to use a concrete field name instead of
defaulting to the _all field. Here are many examples:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/QueryBuilders.java

Without knowing your existing query, it is hard to make suggestions.

Cheers,

Ivan

On Fri, Nov 2, 2012 at 3:51 AM, mohsin husen smhdiu@gmail.com wrote:

hello all

i have email firstname lastname field in the search index.
now at runtime may be user has only specified one of the filed to search
or may be all.
so my question is can we apply dynamic field in java api at runtime
depending upon the fields enter by the user.

thanks
mohsin

--

--


(system) #3