0

Need help with building query through the array in ElasticSearch 6. I have documents that represent some property units with a number of attributes:

{  
   "Unit":{
     "Attributes":{  
        "Attribute":[  
           {  
              "Name":"Elevator",
              "Text":"No"
           },
           {  
              "Name":"Pet Friendly",
              "Text":"Yes"
           }
        ...
        ]   
      }        
   }
}

How can I filter my documents to find all pet friendly units or all units without elevator?

P.S. I am using NEST.

KozhevnikovDmitry
  • 1,660
  • 12
  • 27

1 Answers1

2

Map Attribute as a nested type, probably with Text mapped as keyword for term level matching. To query, use a bool query with filter clauses, where the clauses will be nested queries.

Russ Cam
  • 124,184
  • 33
  • 204
  • 266
  • Thanks a lot! It helps. Could you please take a look on my next question? =) https://stackoverflow.com/questions/50717706/regexp-starts-with-not-working-elasticsearch-6 – KozhevnikovDmitry Jun 06 '18 at 10:08