0

I would like to index documents in Elasticsearch with a multiple values field (not multifield) using NEST. Consider the following data:

{
     "id": "someid",
     "name": "name 1",
     "name": "name 2",
     "name": "name 3"
}

The Lucene query I'm looking to write should look something like this:

name:"name 2"

This query should search all of the name fields. How to do this using NEST?

7
  • Why don't you want to use multifield? Commented Dec 30, 2013 at 13:52
  • Firstly copy & paste the entirety of your JSON into jsonlint.com and validate, look at the outcome Commented Dec 30, 2013 at 13:55
  • If multifield solves my problem, I don't mind using that. But I don't want to search through multiple fields here. I want to be able to index a name x times and search through all of the names. Commented Dec 30, 2013 at 15:12
  • I don't need to validate my json, cause this is valid input for Elasticsearch according to their documentation. Commented Dec 30, 2013 at 15:12
  • @ThomasArdal IEnumerable<string> Name { get; set; } is not an option here? Commented Dec 31, 2013 at 1:06

1 Answer 1

0

You can query using multi_match query as follows

{"multi_match":{"query":"java","fields":["*"]}}]}}
Sign up to request clarification or add additional context in comments.

Comments

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.