# What is the alternative way of querying \_all?

**URL:** https://discuss.elastic.co/t/what-is-the-alternative-way-of-querying-all/207201
**Category:** Elasticsearch
**Created:** [November 9, 2019, 3:16am UTC](https://discuss.elastic.co/t/what-is-the-alternative-way-of-querying-all/207201 "2019-11-09T03:16:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)
#### Post date: [November 9, 2019, 3:16am UTC](https://discuss.elastic.co/t/what-is-the-alternative-way-of-querying-all/207201/1 "2019-11-09T03:16:07Z")

</div>

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 someway what is the recommended way of doing the same now?

I am using dynamic mapping. So as mentioned in [doc](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/mapping-all-field.html) 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`.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 7, 2019, 3:16am UTC](https://discuss.elastic.co/t/what-is-the-alternative-way-of-querying-all/207201/2 "2019-12-07T03:16:19Z")

</div>

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