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.

2
  • may I know your schema mapping for this? Commented Jun 6, 2018 at 5:56
  • @bhoo-day, the issue is solved. But I would be very pleased, if you take a look on my new question Commented Jun 6, 2018 at 10:11

1 Answer 1

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.

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

1 Comment

Thanks a lot! It helps. Could you please take a look on my next question? =) stackoverflow.com/questions/50717706/…

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.