What is the alternative way of querying _all from elasticsearch 6.x onwards?

I posted the same in stackoverflow but did not get any reply. Just posting the same here in case someone has any suggestions.

As mentioned in the doc, from elasticsearch 6.x _all has been deprecated. I have a matchQuery like below

QueryBuilders.boolQuery()
                        .should(QueryBuilders.matchQuery("_all", typeAndName.name))
                        .should(buildMatchQuery(
                                SearchFields.kObjectNameKey,
                                dataModel.getLowerFieldName(PropertyType.STRING, SearchFields.kObjectNameKey),
                                typeAndName.name));

Can someone suggest what is the recommended way of doing the same now?

In my case, I don't know beforehand what all fields can be there in the index so I cannot use copy_to in index mapping to copy all fields data to some other field to simulate all.

Have a look at the copy to functionality.

@Christian_Dahlqvist - As posted above, in my case, I don't know beforehand what all fields can be there in the index so I cannot use copy_to in index mapping to copy all fields data to some other field to simulate all.

Maybe I am missing something.

You should be able to specify it for dynamic mappings through an index template.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.