1

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"]

      },

    }
})
3
  • That doesn't look like a valid query. What are you trying to do? Commented May 18, 2016 at 18:44
  • What do you want to do with your query? Commented May 18, 2016 at 18:45
  • I just updated my question. please look at once. , I want to select only price and brand from my object. but it is not working. Commented May 18, 2016 at 18:48

1 Answer 1

3

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

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

    }
})
Sign up to request clarification or add additional context in comments.

1 Comment

Or you can place the fields after the query block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.