Hello everyone, as mentioned in the title, seem like simple_query_string
with default operator and
doesn't work with nested data type.
For example, i have a mapping like bellow:
PUT test1
{
"mappings": {
"properties": {
"nested_articles" : {
"type" : "nested",
"properties" : {
"article_title" : {
"properties" : {
"en" : {
"type" : "keyword",
"fields" : {
"default" : {
"type" : "text",
"term_vector" : "with_positions_offsets",
"analyzer" : "english"
},
"exact" : {
"type" : "text",
"term_vector" : "with_positions_offsets",
"analyzer" : "english_exact"
}
},
"ignore_above" : 20
}
}
},
"content" : {
"properties" : {
"en" : {
"type" : "keyword",
"fields" : {
"default" : {
"type" : "text",
"term_vector" : "with_positions_offsets",
"analyzer" : "english"
},
"exact" : {
"type" : "text",
"term_vector" : "with_positions_offsets",
"analyzer" : "english_exact"
}
},
"ignore_above" : 20
}
}
}
}
}
}
}
}
As you can see, nested_articles
with type nested has two fields articles_title
and content
. Each field has two analyzers "default" (for stemming) et "exact" (pour exact search). I added a document like this:
PUT test1/_doc/1
{
"nested_articles" : [
{
"article_title" : {
"en": "John"
},
"content" : {
"en": "Smith"
}
},
{
"article_title" : {
"en": "foo"
},
"content" : {
"en": "bar"
}
}
]
}
Problem come when i use simple_query_string
GET test1/_search
{
"query": {
"nested": {
"path": "nested_articles",
"query": {
"simple_query_string": {
"query": "smith bar",
"fields": [
"nested_articles.article_title.en.default^3",
"nested_articles.content.en.default"
],
"default_operator": "and"
}
}
}
}
}
I'm looking for the documents with two words "smith" and "bar", in any field but i have no result here. However, if i search for the words in the same objet (for example, John Smith
with John
in articles
and Smith
in content
), It works like charm.
Do you have any solution (query or mapping) that can work with simple_query_string, default operator and ?
Thank you all.