Can you define an index on two fields?


#1

I know that Elasticsearch (and Lucene) index every field in a document. I was wondering whether there is a way to index on tow fields (much like RDBMS). For instance, most of our queries filter on two types (timestamp, id) (others also filter on an arbitrary third field). Is there a way to achieve this?


(Mark Walkom) #2

All fields are indexed by default, but you cannot do a combined one like you are referring to.
You'd need to merge the fields into a new one and index that.


#3

Thanks @warkolm . Just a question by what you mean by 'merge the fields'? Do you mean concatenating? For instance is there a way to 'merge' a timestamp (date) field and a String (id) field?


(Mark Walkom) #4

Using something like copy_to.


(system) #5