Hi,
I would like to get the response including special characters in my query ,
- I have seen using query string.. and my data sample is :
{ "MakeCode": "2", "Year": "1987", "Model": "APOLLO/SKYLARK",
"YearCode": "1987", "EngineCode": "3", "Engine": "4-151 2.5L",
"ShortYear":"87", "Make": "BUICK", "ModelCode": "2"
when I have used querystring query
GET ymme/ymmetype/_search
{
"size": 50,
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "2 and APOLLO"
}
}
]
}
}
}-----> Am getting response
If I query as:
"query_string": {
"query": "2 and APOLLO/"
}
}-----> throwing SearchPhaseExecutionException[Failed to
execute phase [query]
-
So How can I achieve query string to accept special characters like ('/',
'-', '(', ')', ':' ,'.') , is it possible with query string? if yes then
which pattern I need I would like to know in detail.. -
Another approach also I have tried using "index_name" to keep all my
required field data under that 'index_name' field inorder to search using match,
match_phrase, match_phrase_prefix filters by changing my mapping as shown
below:
Settings and mappings:
PUT twitter1
{
"settings": {
"analysis": {
"analyzer": {
"wordAnalyzer": {
"type": "custom",
"tokenizer": "whitespace"
}
}
}
},
"mappings": {
"tweet1": {
"properties": {
"Engine": {
"index_name": "name",
"type": "string"
},
"EngineCode": {
"type": "string"
},
"Make": {
"index_name": "name",
"type": "string"
},
"MakeCode": {
"type": "string"
},
"Model": {
"index_name": "name",
"type": "string"
},
"ModelCode": {
"type": "string"
},
"ShortYear": {
"index_name": "name",
"type": "string"
},
"Year": {
"index_name": "name",
"type": "string"
},
"YearCode": {
"type": "string"
}
}
}
}
}--------------->"name": "Engine","Make","Model","ShortYear","Year"
I tried the following queries with match, match_phrase,
match_phrase_prefix:
using match
"query": {
"match": {
"name": {
"operator": "and",
"query": "85 m"
}
}
}
This is not returning any records I tried with analyzer
GET twitter1/tweet1/_search
{
"size": 20,
"query": {
"match": {
"name": {
"operator": "and",
"query": "85 m",
"analyzer": "wordAnalyzer"
}
}
}
}---------------> Then all the records are returning
using match_phrase:
"query": {
"match_phrase": {
"name": "85 m"
}
}-----------> no records are returning, if name: 85 mazda ( 1 record) is
returning
using match_phrase_prefix:
"query": {
"match_phrase": {
"name": "85 m"
}
}-----------> returning 3 records with 85 and m combination i.e.,
ShortYear and Make
But when I used another combination like ShortYear and Engine
example:
"query": {
"match_phrase_prefix": {
"name": "85 v"
}
}----------------> where "Engine": "V8-302 5.0L" (0 records are
returning)
Any good approach to solve this problem such that the request may be at any
word any combination the relevant records need to return.
Can any one help me out to resolve this approach.
--
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/191c7d96-eac9-4372-8b14-f7deba1724bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.