User free text query

I need to query elasticsearch and let the user specify on which other
fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are done.

I have a field name "category" with values like "0001,0003" (meaning the
record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on
field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like
"category:0003 computer", this query would need to find records with the
text "computer" on the field "texto", and additionaly have the value "0003"
present on the field "category", is this possible?

Bruno

--
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/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Actually, elasticsearch will search computer in _all field and as you said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead BTW.

If your interface has different inputs for text and category, then you should probably better use the QueryDSL with for example a FilteredQuery, with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche bkamiche@gmail.com a écrit :

I need to query elasticsearch and let the user specify on which other fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are done.

I have a field name "category" with values like "0001,0003" (meaning the record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like "category:0003 computer", this query would need to find records with the text "computer" on the field "texto", and additionaly have the value "0003" present on the field "category", is this possible?

Bruno

--
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/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/21A058BD-5BA5-4BCD-9BDA-8D17651A485F%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

My application interface offers fields for filtering (and they are working
on elastic), but for power users there is always the free text query
option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {
                                                            "datefield" 

: {

"gte" : "some date here",

"lte" : "some date here"
}
}
},
{
"term" : {
"filter1" : 1 }
},
{
"term" : {
"filter2" : 1 }
},
{
"term" : {
"filter3" : [5] }
}
]
}
}
}
}

That is the structure that I use for every query, the filter values vary
upon the choices entered by the user, and the "query" itself gets its value
from a text entry field.

Up to this point everything works fine, but when I put "category:0003
computer" in the query field, it does not return results, although there
are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:

Actually, elasticsearch will search computer in _all field and as you said
0003 in category field.
You should may be disable _all field and use the copy_to feature instead
BTW.

If your interface has different inputs for text and category, then you
should probably better use the QueryDSL with for example a FilteredQuery,
with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche <bkam...@gmail.com <javascript:>>
a écrit :

I need to query elasticsearch and let the user specify on which other
fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are
done.

I have a field name "category" with values like "0001,0003" (meaning the
record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on
field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like
"category:0003 computer", this query would need to find records with the
text "computer" on the field "texto", and additionaly have the value "0003"
present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Replace match with a simpleQueryString query.

David

Le 17 déc. 2014 à 03:13, Bruno Kamiche bkamiche@gmail.com a écrit :

My application interface offers fields for filtering (and they are working on elastic), but for power users there is always the free text query option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {
                                                            "datefield" : {
                                                                    "gte" : "some date here",
                                                                    "lte" : "some date here"
                                                            }
                                                    }
                                            },
                                            {
                                                    "term" : { "filter1" : 1 }
                                            },
                                            {
                                                    "term" : { "filter2" : 1 }
                                            },
                                            {
                                                    "term" : { "filter3" : [5] }
                                            }
                                    ]
                            }
                    }
            }
    }

That is the structure that I use for every query, the filter values vary upon the choices entered by the user, and the "query" itself gets its value from a text entry field.

Up to this point everything works fine, but when I put "category:0003 computer" in the query field, it does not return results, although there are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:
Actually, elasticsearch will search computer in _all field and as you said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead BTW.

If your interface has different inputs for text and category, then you should probably better use the QueryDSL with for example a FilteredQuery, with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche bkam...@gmail.com a écrit :

I need to query elasticsearch and let the user specify on which other fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are done.

I have a field name "category" with values like "0001,0003" (meaning the record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like "category:0003 computer", this query would need to find records with the text "computer" on the field "texto", and additionaly have the value "0003" present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/38A90388-2728-4C38-83AE-A6A2C39010B3%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Ok, it works, but I've found a new problem, it only works if the field
"category" is exactly "0003", it seems that is not taking in account that
some records have that field as "0001,0003" or
"value1,value2,value3,...,0003,0005" and alike...

On Tuesday, December 16, 2014 9:22:22 PM UTC-5, David Pilato wrote:

Replace match with a simpleQueryString query.

David

Le 17 déc. 2014 à 03:13, Bruno Kamiche <bkam...@gmail.com <javascript:>>
a écrit :

My application interface offers fields for filtering (and they are working
on elastic), but for power users there is always the free text query
option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {

"datefield" : {

"gte" : "some date here",

"lte" : "some date here"
}
}
},
{
"term" : {
"filter1" : 1 }
},
{
"term" : {
"filter2" : 1 }
},
{
"term" : {
"filter3" : [5] }
}
]
}
}
}
}

That is the structure that I use for every query, the filter values vary
upon the choices entered by the user, and the "query" itself gets its value
from a text entry field.

Up to this point everything works fine, but when I put "category:0003
computer" in the query field, it does not return results, although there
are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:

Actually, elasticsearch will search computer in _all field and as you
said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead
BTW.

If your interface has different inputs for text and category, then you
should probably better use the QueryDSL with for example a FilteredQuery,
with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche bkam...@gmail.com a écrit :

I need to query elasticsearch and let the user specify on which other
fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are
done.

I have a field name "category" with values like "0001,0003" (meaning the
record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on
field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like
"category:0003 computer", this query would need to find records with the
text "computer" on the field "texto", and additionaly have the value "0003"
present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It’s an analysis issue I believe.
Mostly depends on your mapping for this field.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 17 déc. 2014 à 03:40, Bruno Kamiche bkamiche@gmail.com a écrit :

Ok, it works, but I've found a new problem, it only works if the field "category" is exactly "0003", it seems that is not taking in account that some records have that field as "0001,0003" or "value1,value2,value3,...,0003,0005" and alike...

On Tuesday, December 16, 2014 9:22:22 PM UTC-5, David Pilato wrote:
Replace match with a simpleQueryString query.

David

Le 17 déc. 2014 à 03:13, Bruno Kamiche <bkam...@gmail.com <javascript:>> a écrit :

My application interface offers fields for filtering (and they are working on elastic), but for power users there is always the free text query option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {
                                                            "datefield" : {
                                                                    "gte" : "some date here",
                                                                    "lte" : "some date here"
                                                            }
                                                    }
                                            },
                                            {
                                                    "term" : { "filter1" : 1 }
                                            },
                                            {
                                                    "term" : { "filter2" : 1 }
                                            },
                                            {
                                                    "term" : { "filter3" : [5] }
                                            }
                                    ]
                            }
                    }
            }
    }

That is the structure that I use for every query, the filter values vary upon the choices entered by the user, and the "query" itself gets its value from a text entry field.

Up to this point everything works fine, but when I put "category:0003 computer" in the query field, it does not return results, although there are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:
Actually, elasticsearch will search computer in _all field and as you said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead BTW.

If your interface has different inputs for text and category, then you should probably better use the QueryDSL with for example a FilteredQuery, with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche <bkam...@gmail.com <>> a écrit :

I need to query elasticsearch and let the user specify on which other fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are done.

I have a field name "category" with values like "0001,0003" (meaning the record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like "category:0003 computer", this query would need to find records with the text "computer" on the field "texto", and additionaly have the value "0003" present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com <>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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 mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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/7F4B585C-EA35-4BC8-BFC7-16EC28564A9C%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Any pointers on that?

On Tuesday, December 16, 2014 10:53:26 PM UTC-5, David Pilato wrote:

It’s an analysis issue I believe.
Mostly depends on your mapping for this field.

--
David Pilato | Technical Advocate | Elasticsearch.com
http://Elasticsearch.com

@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr | @scrutmydocs
https://twitter.com/scrutmydocs

Le 17 déc. 2014 à 03:40, Bruno Kamiche <bkam...@gmail.com <javascript:>>
a écrit :

Ok, it works, but I've found a new problem, it only works if the field
"category" is exactly "0003", it seems that is not taking in account that
some records have that field as "0001,0003" or
"value1,value2,value3,...,0003,0005" and alike...

On Tuesday, December 16, 2014 9:22:22 PM UTC-5, David Pilato wrote:

Replace match with a simpleQueryString query.

David

Le 17 déc. 2014 à 03:13, Bruno Kamiche bkam...@gmail.com a écrit :

My application interface offers fields for filtering (and they are
working on elastic), but for power users there is always the free text
query option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {

"datefield" : {

"gte" : "some date here",

"lte" : "some date here"
}
}
},
{
"term" : {
"filter1" : 1 }
},
{
"term" : {
"filter2" : 1 }
},
{
"term" : {
"filter3" : [5] }
}
]
}
}
}
}

That is the structure that I use for every query, the filter values vary
upon the choices entered by the user, and the "query" itself gets its value
from a text entry field.

Up to this point everything works fine, but when I put "category:0003
computer" in the query field, it does not return results, although there
are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:

Actually, elasticsearch will search computer in _all field and as you
said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead
BTW.

If your interface has different inputs for text and category, then you
should probably better use the QueryDSL with for example a FilteredQuery,
with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche bkam...@gmail.com a écrit :

I need to query elasticsearch and let the user specify on which other
fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are
done.

I have a field name "category" with values like "0001,0003" (meaning the
record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on
field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like
"category:0003 computer", this query would need to find records with the
text "computer" on the field "texto", and additionaly have the value "0003"
present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/3dbabf37-f10d-43f0-8c6a-a430c13658d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I don’t know if you are aware of analysis process. If not, you could start reading this: Elasticsearch Platform — Find real-time answers at scale | Elastic http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-analysis.html

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 17 déc. 2014 à 04:55, Bruno Kamiche bkamiche@gmail.com a écrit :

Any pointers on that?

On Tuesday, December 16, 2014 10:53:26 PM UTC-5, David Pilato wrote:
It’s an analysis issue I believe.
Mostly depends on your mapping for this field.

--
David Pilato | Technical Advocate | Elasticsearch.com http://elasticsearch.com/
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 17 déc. 2014 à 03:40, Bruno Kamiche <bkam...@gmail.com <javascript:>> a écrit :

Ok, it works, but I've found a new problem, it only works if the field "category" is exactly "0003", it seems that is not taking in account that some records have that field as "0001,0003" or "value1,value2,value3,...,0003,0005" and alike...

On Tuesday, December 16, 2014 9:22:22 PM UTC-5, David Pilato wrote:
Replace match with a simpleQueryString query.

David

Le 17 déc. 2014 à 03:13, Bruno Kamiche <bkam...@gmail.com <>> a écrit :

My application interface offers fields for filtering (and they are working on elastic), but for power users there is always the free text query option, my query in elastic is as follows:

   "query" : {
            "filtered" : {
                    "query" : {
                            "match" : {
                                    "texto" : {
                                            "query" : "computer",
                                            "operator" : "and"
                                    }
                            }
                    },
                    "filter" : {
                            "bool" :  {
                                    "must" : [
                                            {
                                                    "range" : {
                                                            "datefield" : {
                                                                    "gte" : "some date here",
                                                                    "lte" : "some date here"
                                                            }
                                                    }
                                            },
                                            {
                                                    "term" : { "filter1" : 1 }
                                            },
                                            {
                                                    "term" : { "filter2" : 1 }
                                            },
                                            {
                                                    "term" : { "filter3" : [5] }
                                            }
                                    ]
                            }
                    }
            }
    }

That is the structure that I use for every query, the filter values vary upon the choices entered by the user, and the "query" itself gets its value from a text entry field.

Up to this point everything works fine, but when I put "category:0003 computer" in the query field, it does not return results, although there are results the comply...

On Tuesday, December 16, 2014 8:55:01 PM UTC-5, David Pilato wrote:
Actually, elasticsearch will search computer in _all field and as you said 0003 in category field.
You should may be disable _all field and use the copy_to feature instead BTW.

If your interface has different inputs for text and category, then you should probably better use the QueryDSL with for example a FilteredQuery, with a matchQuery and a termFilter.

My 2 cents
David

Le 17 déc. 2014 à 02:27, Bruno Kamiche <bkam...@gmail.com <>> a écrit :

I need to query elasticsearch and let the user specify on which other fields to search for certain attributes...

I have a field named "texto" with the actual text on which queries are done.

I have a field name "category" with values like "0001,0003" (meaning the record is on categories 1 and 3), or "0001,0005,0007", etc...

If the user enters a search criteria like "computer" it will search on field "texto" for the text computer, that works fine.

But I guess there is an option, in which you can specify things like "category:0003 computer", this query would need to find records with the text "computer" on the field "texto", and additionaly have the value "0003" present on the field "category", is this possible?

Bruno

--
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 elasticsearc...@googlegroups.com <>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/36882ade-d788-43b7-95fb-96f6d653f934%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/de59e565-8b10-4cae-8fdb-17aa43591804%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/03ff907c-e273-48a4-9b82-fc90201cea6d%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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 mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3dbabf37-f10d-43f0-8c6a-a430c13658d8%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/3dbabf37-f10d-43f0-8c6a-a430c13658d8%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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/5370064F-EF61-46B1-9262-69B54E2FD404%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.