简体   繁体   中英

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

      },

    }
})

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

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

    }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM