Default_operator not working


#1

Hi, I try run:

oracle AND san AND francisco AND hadoop

Get total of 1118 matches.

Then I try:

oracle san francisco hadoop

I get total of 59 matches.

Query looks like:

[
'query' => [
'function_score' => [
'query' => [
"bool" => [
"must" => [
'query_string' => [
'query' => $query, 'default_operator' => 'AND'
]
],
'filter' => [
'range' => [
'completeness' => [
'from'=>0.30, 'to'=> 1.0
]
]
]
]
],
'field_value_factor' => [
'field' => 'completeness'
]
]
],


(David Pilato) #2

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.


#3

total result: 8077

{
"query": {
"query_string": {
"default_operator": "AND",
"query": "oracle AND san AND francisco AND hadoop"
}
}
}

total 331:

{
"query": {
"query_string": {
"default_operator": "AND",
"query": "oracle san francisco hadoop"
}
}
}


(David Pilato) #4

This works well on my end.

BTW here is what a reproduction script is:

DELETE test 
PUT test 
POST test/_doc
{
  "text": "oracle san francisco hadoop"
}
POST test/_doc
{
  "text": "oracle"
}
POST test/_doc
{
  "text": "san francisco"
}
POST test/_doc
{
  "text": "hadoop"
}
GET test/_search
{
  "query": {
    "query_string": {
      "query": "oracle AND san AND francisco AND hadoop"
    }
  }
}
GET test/_search
{
  "query": {
    "query_string": {
      "default_operator": "AND", 
      "query": "oracle san francisco hadoop"
    }
  }
}

#5

Maybe it work only with 1 field. I have about 10 different search fields.


(David Pilato) #6

Maybe it work only with 1 field. I have about 10 different search fields.

How can I know?

If you need help, please do what I asked at


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.