Voora Tarun
Voora Tarun

Reputation: 1216

Elasticsearch query with fields not working

Hi i am new to elastic search database, When i want to search with fields I am getting following error. Help me to solve this.

Trace: [query_parsing_exception] [filtered] query does not support [fields], with { index=test_database line=1 col=58 }  

My Code to search:

 client.search({
  index: 'test_database',
    body: {
      query : {
           match_all : {},
          fields: ["price","brand"]

      },

    }
})

Upvotes: 1

Views: 863

Answers (1)

sunkuet02
sunkuet02

Reputation: 2442

You can try this. As, match all query doesn't support fields.

client.search({
   index: 'test_database',
      body: {
          fields: ["price","brand"],
          query : {
              match_all : {}
      }

    }
})

Upvotes: 3

Related Questions