Filtered Nested Filter with Multiple condition Returning Bad Request


(Yusbel Garcia) #1

I'm having parse error when posting a filtered nested object during search,
bellow my posting data and the indexed data.

Data posted:

{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "ro",
"fields": [
"LegalName^70",
"LegalName.raw^70",
"Alias^15",
"RelationshipName^12",
"Address^10",
"NaicsCode^1",
"Phone^10",
"LesseeNumber^1",
"FullName^40",
"FirstName^40",
"LastName^40",
"FullName.raw^50",
"Relationship^15",
"DobYear^5"
],
"tie_breaker": 0.3,
"operator": "or",
"type": "best_fields"
}
},
"filter": {
"nested": {
"path": "SecurityScope",
"filter": {
"bool": {
"must": [
{
"term": {
"SecurityScope.FunderId": "1"
}
}
],
"should": [
{
"term": {
"ContentStatus": "1"
}
}
]
}
}
}
}
}

},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"</em>"
],
"tags_schema": "styled",
"fragment_size": "150",
"number_of_fragments": "3",
"order": "score",
"fields": {
"LegalName": {

  },
  "LegalName.raw": {
    
  },
  "Alias": {
    
  },
  "RelationshipName": {
    
  },
  "Address": {
    
  },
  "NaicsCode": {
    
  },
  "Phone": {
    
  },
  "LesseeNumber": {
    
  },
  "FullName": {
    
  },
  "FirstName": {
    
  },
  "LastName": {
    
  },
  "FullName.raw": {
    
  },
  "Relationship": {
    
  },
  "DobYear": {
    
  }
}

}
}

Data Indexed:

{
"_index": "intellisearch",
"_type": "business",
"_id": "33009",
"_score": 1,
"_source": {
"Identifier": "33009",
"ContentStatus": 1,
"Links": null,
"ApplicantId": 33009,
"ApplicantTypeCode": "COM",
"LegalName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"Alias": "INTEGRATED INDUSTRIAL SUPPLY INC",
"BusinessName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"OperationName": "",
"RelationshipName": "",
"Address": "1337 W BETTERAVIA RD SANTA MARIA CALIFORNIA USA",
"AddressLine1": "1337 W BETTERAVIA RD",
"AddressLine2": "",
"AddressLine3": "",
"City": "SANTA MARIA",
"Province": "CALIFORNIA",
"Country": "USA",
"NaicsCode": "0",
"NaicsDescription": "N/A",
"Phone": "8059258468",
"LesseeNumber": "",
"Score": 0,
"BusinessStartDateYear": "1900",
"ContentDocType": 2,
"Extended": null,
"SecurityScope": {
"FunderId": "1"
}
}

Can you give me a hint?

Thank you,

Yusbel

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0b5abfb8-2807-44b7-9779-d00aa5c8df3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Yusbel Garcia) #2

I havent figure out what is causing parse error. I have a nested mapping in
place (i just omitting it).

If i do a nested filter by itself it work as expected, but I want to
combine a should not nested filter with a must nested filter, bellow what
I'm posting:

{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "ro",
"fields": [
"LegalName^70",
"LegalName.raw^70",
"Alias^15",
"RelationshipName^12",
"Address^10",
"NaicsCode^1",
"Phone^10",
"LesseeNumber^1",
"FullName^40",
"FirstName^40",
"LastName^40",
"FullName.raw^50",
"Relationship^15",
"DobYear^5"
],
"tie_breaker": 0.3,
"operator": "or",
"type": "best_fields"
}
},
"filter": {
"bool": {
"should": [
{
"term": {
"ContentStatus": "1"
}
}
],
"must": {
"filter": {
"bool": {
"nested": [
{
"term": {
"SecurityScope.FunderId": "1"
}
}
]
}
}
}
}
}
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"</em>"
],
"tags_schema": "styled",
"fragment_size": "150",
"number_of_fragments": "3",
"order": "score",
"fields": {
"LegalName": {

  },
  "LegalName.raw": {
    
  },
  "Alias": {
    
  },
  "RelationshipName": {
    
  },
  "Address": {
    
  },
  "NaicsCode": {
    
  },
  "Phone": {
    
  },
  "LesseeNumber": {
    
  },
  "FullName": {
    
  },
  "FirstName": {
    
  },
  "LastName": {
    
  },
  "FullName.raw": {
    
  },
  "Relationship": {
    
  },
  "DobYear": {
    
  }
}

}
}

Any hint?

On Thursday, May 28, 2015 at 3:31:29 PM UTC-4, Yusbel Garcia wrote:

I'm having parse error when posting a filtered nested object during
search, bellow my posting data and the indexed data.

Data posted:

{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "ro",
"fields": [
"LegalName^70",
"LegalName.raw^70",
"Alias^15",
"RelationshipName^12",
"Address^10",
"NaicsCode^1",
"Phone^10",
"LesseeNumber^1",
"FullName^40",
"FirstName^40",
"LastName^40",
"FullName.raw^50",
"Relationship^15",
"DobYear^5"
],
"tie_breaker": 0.3,
"operator": "or",
"type": "best_fields"
}
},
"filter": {
"nested": {
"path": "SecurityScope",
"filter": {
"bool": {
"must": [
{
"term": {
"SecurityScope.FunderId": "1"
}
}
],
"should": [
{
"term": {
"ContentStatus": "1"
}
}
]
}
}
}
}
}

},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"</em>"
],
"tags_schema": "styled",
"fragment_size": "150",
"number_of_fragments": "3",
"order": "score",
"fields": {
"LegalName": {

  },
  "LegalName.raw": {
    
  },
  "Alias": {
    
  },
  "RelationshipName": {
    
  },
  "Address": {
    
  },
  "NaicsCode": {
    
  },
  "Phone": {
    
  },
  "LesseeNumber": {
    
  },
  "FullName": {
    
  },
  "FirstName": {
    
  },
  "LastName": {
    
  },
  "FullName.raw": {
    
  },
  "Relationship": {
    
  },
  "DobYear": {
    
  }
}

}
}

Data Indexed:

{
"_index": "intellisearch",
"_type": "business",
"_id": "33009",
"_score": 1,
"_source": {
"Identifier": "33009",
"ContentStatus": 1,
"Links": null,
"ApplicantId": 33009,
"ApplicantTypeCode": "COM",
"LegalName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"Alias": "INTEGRATED INDUSTRIAL SUPPLY INC",
"BusinessName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"OperationName": "",
"RelationshipName": "",
"Address": "1337 W BETTERAVIA RD SANTA MARIA CALIFORNIA USA",
"AddressLine1": "1337 W BETTERAVIA RD",
"AddressLine2": "",
"AddressLine3": "",
"City": "SANTA MARIA",
"Province": "CALIFORNIA",
"Country": "USA",
"NaicsCode": "0",
"NaicsDescription": "N/A",
"Phone": "8059258468",
"LesseeNumber": "",
"Score": 0,
"BusinessStartDateYear": "1900",
"ContentDocType": 2,
"Extended": null,
"SecurityScope": {
"FunderId": "1"
}
}

Can you give me a hint?

Thank you,

Yusbel

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8c367658-e2fe-4f47-944f-8ebc11b78ef5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Yusbel Garcia) #3

OK i just figure it out, Do there is a more effcient query?

{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "rob",
"fields": [
"LegalName^70",
"LegalName.raw^70",
"Alias^15",
"RelationshipName^12",
"Address^10",
"NaicsCode^1",
"Phone^10",
"LesseeNumber^1",
"FullName^40",
"FirstName^40",
"LastName^40",
"FullName.raw^50",
"Relationship^15",
"DobYear^5"
],
"tie_breaker": 0.3,
"operator": "or",
"type": "best_fields"
}
},
"filter": {
"bool": {
"should": [
{
"term": {
"ContentStatus": "1"
}
}
],
"must": {
"nested": {
"path": "SecurityScope",
"filter": {
"bool": {
"must": [
{
"term": {
"SecurityScope.FunderId": "1"
}
}
]
}
}
}
}
}
}
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"</em>"
],
"tags_schema": "styled",
"fragment_size": "150",
"number_of_fragments": "3",
"order": "score",
"fields": {
"LegalName": {

  },
  "LegalName.raw": {
    
  },
  "Alias": {
    
  },
  "RelationshipName": {
    
  },
  "Address": {
    
  },
  "NaicsCode": {
    
  },
  "Phone": {
    
  },
  "LesseeNumber": {
    
  },
  "FullName": {
    
  },
  "FirstName": {
    
  },
  "LastName": {
    
  },
  "FullName.raw": {
    
  },
  "Relationship": {
    
  },
  "DobYear": {
    
  }
}

}
}

On Thursday, May 28, 2015 at 3:31:29 PM UTC-4, Yusbel Garcia wrote:

I'm having parse error when posting a filtered nested object during
search, bellow my posting data and the indexed data.

Data posted:

{
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "ro",
"fields": [
"LegalName^70",
"LegalName.raw^70",
"Alias^15",
"RelationshipName^12",
"Address^10",
"NaicsCode^1",
"Phone^10",
"LesseeNumber^1",
"FullName^40",
"FirstName^40",
"LastName^40",
"FullName.raw^50",
"Relationship^15",
"DobYear^5"
],
"tie_breaker": 0.3,
"operator": "or",
"type": "best_fields"
}
},
"filter": {
"nested": {
"path": "SecurityScope",
"filter": {
"bool": {
"must": [
{
"term": {
"SecurityScope.FunderId": "1"
}
}
],
"should": [
{
"term": {
"ContentStatus": "1"
}
}
]
}
}
}
}
}

},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"</em>"
],
"tags_schema": "styled",
"fragment_size": "150",
"number_of_fragments": "3",
"order": "score",
"fields": {
"LegalName": {

  },
  "LegalName.raw": {
    
  },
  "Alias": {
    
  },
  "RelationshipName": {
    
  },
  "Address": {
    
  },
  "NaicsCode": {
    
  },
  "Phone": {
    
  },
  "LesseeNumber": {
    
  },
  "FullName": {
    
  },
  "FirstName": {
    
  },
  "LastName": {
    
  },
  "FullName.raw": {
    
  },
  "Relationship": {
    
  },
  "DobYear": {
    
  }
}

}
}

Data Indexed:

{
"_index": "intellisearch",
"_type": "business",
"_id": "33009",
"_score": 1,
"_source": {
"Identifier": "33009",
"ContentStatus": 1,
"Links": null,
"ApplicantId": 33009,
"ApplicantTypeCode": "COM",
"LegalName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"Alias": "INTEGRATED INDUSTRIAL SUPPLY INC",
"BusinessName": "INTEGRATED INDUSTRIAL SUPPLY INC",
"OperationName": "",
"RelationshipName": "",
"Address": "1337 W BETTERAVIA RD SANTA MARIA CALIFORNIA USA",
"AddressLine1": "1337 W BETTERAVIA RD",
"AddressLine2": "",
"AddressLine3": "",
"City": "SANTA MARIA",
"Province": "CALIFORNIA",
"Country": "USA",
"NaicsCode": "0",
"NaicsDescription": "N/A",
"Phone": "8059258468",
"LesseeNumber": "",
"Score": 0,
"BusinessStartDateYear": "1900",
"ContentDocType": 2,
"Extended": null,
"SecurityScope": {
"FunderId": "1"
}
}

Can you give me a hint?

Thank you,

Yusbel

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2c2eefb3-6686-43b4-abb6-e40b82e9dedf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4