GET /companies_v1/_search
{
"query": {
"simple_query_string": {
"query": "so-well"
}
}
}
This works fine.
The same I need to search in Nested objects and in non nested at the same time. My full document contain more than 500 fields, most of them are in nested level. when I search non nested It's working fine, but not for nested fields.
I tried to create a sample .. like below, but no luck.. getting empty result.
Which version of Elasticsearch are you using ? Using a must in your boolean query makes the match in each nested level mandatory. Is it what you're expecting ? A document should match only if it matches a non-nested field and at least one field in each nested path clause ? I tried you recreation in 6.2 and it works as expected, what happens if you change the must to a should ?
FYI,
the "so-well" value is matched one of the property in companyName nested object
in companyName object I have Id, name and city... it matched with name.
GET companies/_search
{
"query": {
"bool": {
"must": [{
"nested": {
"query": {
"bool": {
"must": [{
"simple_query_string": {
"query": "so-well",
"fields": ["companyName.name"]
}
}]
}
},
"path": "companyName"
}
}]
}
}
}
.. this is working for nested when I give exact match and field name. if I am not specifying field name then it is returning by default 10 records which matched 1 record and rest other 9 records
But my requirement is to search the input("so-well") in all fields(including nested objects) in my document wherever it matches. for example if it matches in 10 records it should return matched records.
Yeah. As i said it's unrelated to your question. I was just saying that if you are looking for an hosted elasticsearch as a service solution you should checkout this page: https://www.elastic.co/cloud
Sorry, I didn't read your post properly,
Yeah, We are using elastic cloud(14 days trial version) and aws elastic cloud to evaluate.
Later we will take a call on which to go.
(To me the choice is pretty obvious as cloud by elastic is the only way to have access to X-Pack. Think about what is there like Security, Monitoring, Reporting and what is coming like Canvas, SQL... But I might be biased though )
Hi,
Below is working for me....
is this fine to get nested and non-nested values with same query, if this is correct, what about performance (500 fields), is there any issue while searching more than 2 million records.
Or any other way to get, if yes, could you please provide sample mapping and query for nested or non nested
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.